<%-- 
    Document   : listitem
    Created on : Oct 16, 2011, 3:49:51 AM
    Author     : beryl
--%>

<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
<table width="100%" class="mt10 bor-t-c" border="0">
    <s:iterator value="items">
        <s:url id="url_changeItem" value="">
            <s:param name="itemID" value="itemId"/>
        </s:url>
        <tr class="user-tr">
            <td rowspan="4"><img height="100" src="<s:property value='itemImagePath'/>"></td>
            <td>Name:</td>
            <td><s:property value="itemName"/></td>
            <td align="center" rowspan="4">
                <s:if test="%{ itemPrice > current_points }">
                    <button type="button" disabled ="disabled">Not Enough Points</button>
                </s:if>
                <s:else>
                    <button type="button" >Redeem</button>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <br/><br/>
                    <a href="https://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="MDGordonGao">Tweet</a>
                    <div class="fb-like" data-send="false" data-layout="button_count" data-width="15" data-show-faces="true"></div>
                </s:else>
            </td>
        </tr>
        <tr class="user-tr">
            <td>Description:</td>
            <td><s:property value="itemDescription"/></td>
            <td></td>
        </tr>
        <tr class="user-tr">
            <td>Price:</td>
            <td><s:property value="itemPrice"/>&nbsp;point(s)</td>
        </tr>
        <tr class="user-tr">
            <td>Amount:</td>
            <td><s:property value="itemAmount"/></td>
        </tr>
    </s:iterator>
    <tr class="user-tr"><td colspan="4"></td></tr>
</table>
page <s:property value="now"/> of <s:property value="pageCount"/>&nbsp;&nbsp;
<s:url id="url_pre" value="ItemAction_listItems">
    <s:param name="now" value="now-1"/>
</s:url>
<s:url id="url_first" value="ItemAction_listItems">
    <s:param name="now" value="1"/>
</s:url>
<s:url id="url_next" value="ItemAction_listItems">
    <s:param name="now" value="now+1"/>
</s:url>
<s:url id="url_last" value="ItemAction_listItems">
    <s:param name="now" value="pageCount"/>
</s:url>
<s:a onclick="dojo.event.topic.publish('/alinkrefreshitemfirst');">first</s:a>
<s:if test="now!=1">
    <s:a onclick="dojo.event.topic.publish('/linkrefreshitempre');">pre</s:a>
</s:if>
<s:if test="now!=pageCount">
    <s:a onclick="dojo.event.topic.publish('/linkrefreshitemnext');">next</s:a>
</s:if>
<s:a onclick="dojo.event.topic.publish('/linkrefreshitemlast');">last</s:a>
<sx:a href="%{url_first}" indicator="loadingImage" id="linkrefreshitemfirst" targets="itempage" afterNotifyTopics="/afterListItem,/afterList" listenTopics="/linkrefreshitemfirst" executeScripts="true" />
<sx:a href="%{url_pre}" indicator="loadingImage" id="linkrefreshitempre" listenTopics="/linkrefreshitempre" targets="itempage" afterNotifyTopics="/afterListItem,/afterList" executeScripts="true" />
<sx:a href="%{url_next}" indicator="loadingImage" id="linkrefreshitemnext" listenTopics="/linkrefreshitemnext" targets="itempage" afterNotifyTopics="/afterListItem,/afterList" executeScripts="true" />
<sx:a href="%{url_last}" indicator="loadingImage" id="linkrefreshitemlast" listenTopics="/linkrefreshitemlast" targets="itempage" afterNotifyTopics="/afterListItem,/afterList" executeScripts="true" />

<script type="text/javascript">
    $("button").button().attr("autocomplete", "off");
    document.getElementById("cur_point").innerHTML=${session.user.points};
    fb(document, 'script', 'facebook-jssdk');
</script>
